package com.dmp

/**
  * ClassName:RptUtils
  * Package:com.dmp
  * Desciption:
  *
  * @date:2019 /8/23 20:09
  * @author:17611219021 @sina.cn
  */
object RptUtils {
  def  calculateReq(  requestmode:String,processnode:String) ={
    //原始请求、有效请求、广告请求
    if(requestmode .equals("1") && processnode.equals("1")){
      List[Double](1,0,0)
    }else if(requestmode .equals("1") && processnode.equals("2")){
      List[Double](1,1,0)
    }else if(requestmode .equals("1") && processnode.equals("3")){
      List[Double](1,1,1)
    }else{
      List[Double](0,0,0)
    }
  }

  def calculateRtb(iseffective:String,isbiding:String,isbid:String,adorderid:String,iswin: String,adpayment:String,winprice:String): List[Double] ={
    //参与竞价、竞价成功、消费、成本
    if(iseffective .equals("1") &&isbiding.equals("1") && isbid.equals("1") && !adorderid.equals("0")){
      List[Double](1,0,0,0)
    }else if(iseffective .equals("1") && isbiding.equals("1") && iswin.equals("1")){
      List[Double](0,1,adpayment.toDouble,winprice.toDouble)
    }else{
      List[Double](0,0,0,0)
    }
  }

  def calculateShowOrClick(requestmode:String ,iseffective:String): List[Double] ={
    if(requestmode .equals("2") && iseffective.equals("1")){
      List[Double](1,0)
    }else if(requestmode .equals("3") && iseffective.equals("1")){
      List[Double](0,1)
    }else{
      List[Double](0,0)
    }
  }

}
